package com.codrim.cs.data.rpc.dto.result;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

import lombok.Data;

/**
 * 渠道逐天汇总数据
 *
 * @author Liang.Zhuge
 */
@Data
public class AffiliateWholeDayDataForPeriodResultDTO implements Serializable {
    /**
     * 统计数据
     */
    List<WholeDayDataResultDTO> wholeDayDataResultDTOList;
    /**
     * 实时数据
     */
    List<RealTimeDataDTO> realTimeDataDTOList;

    public void union(List<WholeDayDataResultDTO> wholeDayData) {
        if (CollectionUtils.isNotEmpty(wholeDayData)) {
            wholeDayDataResultDTOList = ListUtils.union(
                    Optional.ofNullable(wholeDayDataResultDTOList).orElse(new ArrayList<>()),
                    wholeDayData);
        }
    }
}
